﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UCRegister.ascx.cs" Inherits="WebUI.UserControls.UCRegister" %>
<div class="MessageBoxBackgroundRegister" id="pageDimmerRegister">&nbsp;</div>
<div class="MesageBoxDivRegister" id="msgboxRegister">
    <div style="margin:10px;">    
    <div class="MesageBoxTableRegister" id="msgTableRegister">
        <div class="Registercontents">
            <div class="Registertitleclose" onclick="CloseRegister();"><img src="/Images/adler_close.gif" alt="" style="height:24px; width:24px;" /></div>
            <div class="Registertitle">CREATE ACCOUNT</div>
            <div class="Registerdiscription">
                Fill out the following form in order to register with Adler.<br />                We will save the details you provide in order to facilitate your purchases on our website.
            </div>
            <div class="Registertitlecontents">
                <div class="require">* Required field</div>
                <div class="title">USER ACCOUNT</div>
                <div class="text">Enter your e-mail address and password to log in.</div>
                <div class="item">
                    <div class="itemleft">Email Address *</div>
                    <div class="itemright">
                        <div class="div_border_textbox">
                            <asp:TextBox ID="txtEmail" runat="server" MaxLength="50" CssClass="csstextbox" Font-Size="12px"></asp:TextBox>
                        </div>
                    </div>
                </div>
                <div class="item">
                    <div class="itemleft">Password *</div>
                    <div class="itemright">
                        <div class="div_border_textbox">
                            <asp:TextBox ID="txtPassword" runat="server" MaxLength="50" TextMode="Password" CssClass="csstextbox" Font-Size="12px"></asp:TextBox>
                        </div>
                    </div>
                </div>
                <div class="item">
                    <div class="itemleft">Confirm Password *</div>
                    <div class="itemright">
                        <div class="div_border_textbox">
                            <asp:TextBox ID="txtConfirmPass" runat="server" MaxLength="50" TextMode="Password" CssClass="csstextbox" Font-Size="12px"></asp:TextBox>
                        </div>
                    </div>
                </div>
                <div class="height30"></div>
                <div class="title">CONTACT DETAILS</div>
                <div class="item">
                    <div class="itemleft">Full Name *</div>
                    <div class="itemright">
                        <div class="div_border_textbox">
                            <asp:TextBox ID="txtName" runat="server" MaxLength="300" CssClass="csstextbox" Font-Size="12px"></asp:TextBox>
                        </div>
                    </div>
                </div>
                <div class="item">
                    <div class="itemleft"></div>
                    <div class="itemright">
                        <asp:RadioButtonList ID="rdGender" runat="server" RepeatDirection="Horizontal">
                            <asp:ListItem Value="1" Selected="True">Male</asp:ListItem>
                            <asp:ListItem Value="0">Female</asp:ListItem>
                        </asp:RadioButtonList>
                    </div>
                </div>
                <div class="item">
                    <div class="itemleft">Date Born</div>
                    <div class="itemright">
                        <div class="div_border_dropdown" style="width:75px;">
                            <asp:DropDownList ID="ddlday" runat="server" Font-Size="12px" CssClass="cssdropdown" Width="70px">
                            </asp:DropDownList>
                        </div>
                        <div class="div_border_dropdown" style="width:75px;">
                            <asp:DropDownList ID="ddlmonth" runat="server" Font-Size="12px" CssClass="cssdropdown" Width="70px">
                            </asp:DropDownList>
                        </div>
                        <div class="div_border_dropdown" style="width:75px;">
                            <asp:DropDownList ID="ddlyear" runat="server" Font-Size="12px" CssClass="cssdropdown" Width="70px">
                            </asp:DropDownList>
                        </div>
                    </div>
                </div>
                <div class="item">
                    <div class="itemleft">Address *</div>
                    <div class="itemright">
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <div class="div_border_dropdown">
                            <asp:DropDownList ID="ddlCity" runat="server" Font-Size="12px" CssClass="cssdropdown" AutoPostBack="True"  onselectedindexchanged="ddlcity_SelectedIndexChanged">
                            </asp:DropDownList>
                        </div>
                        <div class="div_border_dropdown">
                            <asp:DropDownList ID="ddlDistrict" runat="server" Font-Size="12px" CssClass="cssdropdown" AutoPostBack="True"  onselectedindexchanged="ddldistrict_SelectedIndexChanged">
                            </asp:DropDownList>
                        </div>
                        <div class="div_border_dropdown">
                            <asp:DropDownList ID="ddlWard" runat="server" Font-Size="12px" CssClass="cssdropdown">
                            </asp:DropDownList>
                        </div>
                    </ContentTemplate>
                    </asp:UpdatePanel>
                    </div>
                </div>
                <div class="item">
                    <div class="itemleft"></div>
                    <div class="itemright">
                        <div class="div_border_textbox" style="width:308px;">
                            <asp:TextBox ID="txtAddress" runat="server" MaxLength="300" Width="300px" CssClass="csstextbox" Font-Size="12px"></asp:TextBox>
                        </div>
                    </div>
                </div>
                <div class="item">
                    <div class="itemleft">Phone *</div>
                    <div class="itemright">
                        <div class="div_border_textbox">
                            <asp:TextBox ID="txtPhone" runat="server" MaxLength="20" onkeypress="return keypress(event);" CssClass="csstextbox" Font-Size="12px"></asp:TextBox>
                        </div>
                    </div>
                </div>
                <div class="Registerbottomcheck">
                    <asp:CheckBox ID="chkCheck1" runat="server" Checked="true" />&nbsp;I wish to receive Adler news on my e-mail.<br />                    <asp:CheckBox ID="chkCheck2" runat="server" Checked="true"/>&nbsp;I accept the privacy statement.
                </div>
                <%--<div class="button"></div>--%>
                <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                <ContentTemplate>
                    <asp:Button ID="btnRegister" runat="server" Text="CREATE ACCOUNT" CssClass="button" OnClientClick="return checkemptyRegister();" onclick="btnRegister_Click"/>
                </ContentTemplate>
                </asp:UpdatePanel>
            </div>
        </div>
    </div>
    </div>
</div>

<script type="text/javascript">
    function checkemptyRegister() {
        var txtEmail = document.getElementById('<%=txtEmail.ClientID %>').value.trim();
        var txtPassword = document.getElementById('<%=txtPassword.ClientID %>').value.trim();
        var txtConfirmPass = document.getElementById('<%=txtConfirmPass.ClientID %>').value.trim();
        var txtName = document.getElementById('<%=txtName.ClientID %>').value.trim();
        var txtAddress = document.getElementById('<%=txtAddress.ClientID %>').value.trim();
        var txtPhone = document.getElementById('<%=txtPhone.ClientID %>').value.trim();        
        
        if (txtEmail == null || txtEmail == '') {
            alert("Email is empty!");
            document.getElementById('<%=txtEmail.ClientID %>').focus();
            return false;
        }

        var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
        if (!filter.test(txtEmail)) {
            alert("Email is not correct!");
            document.getElementById('<%=txtEmail.ClientID %>').value = '';
            document.getElementById('<%=txtEmail.ClientID %>').focus();
            return false;
        }

        if (txtPassword == null || txtPassword == '') {
            alert("Password is empty!");
            document.getElementById('<%=txtPassword.ClientID %>').focus();
            return false;
        }

        if (txtConfirmPass == null || txtConfirmPass == '') {
            alert("Confirm Password is empty!");
            document.getElementById('<%=txtConfirmPass.ClientID %>').focus();
            return false;
        }

        if (txtPassword != txtConfirmPass) {
            alert("Password does not match.");
            document.getElementById('<%=txtConfirmPass.ClientID %>').value = '';
            document.getElementById('<%=txtConfirmPass.ClientID %>').focus();
            return false;
        }

        if (txtName == null || txtName == '') {
            alert("Full Name is empty!");
            document.getElementById('<%=txtName.ClientID %>').focus();
            return false;
        }

        if (txtAddress == null || txtAddress == '') {
            alert("Address is empty!");
            document.getElementById('<%=txtAddress.ClientID %>').focus();
            return false;
        }

        if (txtPhone == null || txtPhone == '') {
            alert("Phone is empty!");
            document.getElementById('<%=txtPhone.ClientID %>').focus();
            return false;
        }
        return true;
    }
</script>